package mock.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

public class ChooseATMAction extends ActionSupport implements SessionAware{
	
	private String txtATM;
	private Map<String, Object> session;

	public String getTxtATM() {
		return txtATM;
	}

	public void setTxtATM(String txtATM) {
		this.txtATM = txtATM;
	}
	
	@Override
	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		session = arg0;
	}

	/**
	 * Chon may ATM, that ra la co 1 thoi! Nhung ma thoi ke!
	 */
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		if(txtATM == null) return "error";
		int atmID = Integer.parseInt(txtATM);
		session.put("ATMID", atmID);
		return "success";
	}
	
	

}
